﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.Common;
using DataAccessClasses;

namespace eschoolBO
{
    public class reportcard
    {
        iDAC DAC = DACFactory.GetDAC();
        private long _r_id = -99;
        private string _student_name = "";
        private string _subject_name = "";
        private long _a_max = -99;
        private long _a_obt = -99;
        private long _q_max = -99;
        private long _q_obt = -99;
        private long _hy_max = -99;
        private long _hy_obt = -99;
        private long _total = -99;
        private double _percentage = -99;
        private string _grade = "";

        public long r_id
        {
            get { return _r_id; }
            set { _r_id = value; }
        }
        public string student_name
        {
            get { return _student_name; }
            set { _student_name = value; }
        }
        public string subject_name
        {
            get { return _subject_name; }
            set { _subject_name = value; }
        }
        public long a_max
        {
            get { return _a_max; }
            set { _a_max = value; }
        }
        public long a_obt
        {
            get { return _a_obt; }
            set { _a_obt = value; }
        }
        public long q_max
        {
            get { return _q_max; }
            set { _q_max = value; }
        }
        public long q_obt
        {
            get { return _q_obt; }
            set { _q_obt = value; }
        }
        public long hy_max
        {
            get { return _hy_max; }
            set { _hy_max = value; }
        }
        public long hy_obt
        {
            get { return _hy_obt; }
            set { _hy_obt = value; }
        }
        public long total
        {
            get { return _total; }
            set { _total = value; }
        }
        public double percentage
        {
            get { return _percentage; }
            set { _percentage = value; }
        }
        public string grade
        {
            get { return _grade; }
            set { _grade = value; }
        }
        public long SaveRecords()
        {
            try
            {
                DbParameter dbparam0 = DAC.Parameter("@r_id", r_id, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam1 = DAC.Parameter("@student_name", student_name, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam2 = DAC.Parameter("@subject_name", subject_name, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam3 = DAC.Parameter("@a_max", a_max, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam4 = DAC.Parameter("@a_obt", a_obt, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam5 = DAC.Parameter("@q_max", q_max, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam6 = DAC.Parameter("@q_obt", q_obt, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam7 = DAC.Parameter("@hy_max", hy_max, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam8 = DAC.Parameter("@hy_obt", hy_obt, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam9 = DAC.Parameter("@total", total, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam10 = DAC.Parameter("@percentage", percentage, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam11 = DAC.Parameter("@grade", grade, DbType.AnsiString, ParameterDirection.Input);
                DbParameter[] dbparamcall = new DbParameter[] { dbparam0, dbparam1, dbparam2, dbparam3, dbparam4, dbparam5, dbparam6, dbparam7, dbparam8, dbparam9, dbparam10, dbparam11 };
                return DAC.Save("reportcard_save", dbparamcall);
            }
            catch (Exception ex)
            {
                //return Result = -99;
            } return -99;
        }
        public void deletetable(string sql)
        {
            DAC.ExecuteNonQuery(sql);
        }
    }
}